{% extends "base.html" %}
{% import "bootstrap/wtf.html" as wtf %}
{% import "_macros.html" as macros %}

{% block title %}{{ show_title() }} - 文章{% endblock %}

{% block head %}
{{- super() -}}
<link rel="stylesheet" type="text/css"
      href="{{ url_for('blog.static', filename='css/styles.css') }}">
<link rel="stylesheet" type="text/css"
      href="{{ url_for('blog.static', filename='editor.md/css/editormd.min.css') }}">
<link rel="stylesheet" type="text/css"
      href="{{ url_for('blog.static', filename='editor.md/css/editormd.preview.min.css') }}">
{% endblock %}

{% block page_content %}
<div class="container-fluid">
    <div class="row">
        <div class="col-xs-12 col-md-9">
            {% include '_posts.html' %}
            <h3 id="comments">评论</h3>
            {% if current_user.is_authenticated %}
            <div class="comment-form">{{ wtf.quick_form(form) }}</div>
            {% else %}
            <a href="{{ url_for('auth.login') }}" class="btn btn-primary">登陆后评论</a>
            <a href="{{ url_for('auth.register') }}" class="btn btn-default">注册</a>
            {% endif %}

            {% include '_comments.html' %}

            {% if pagination %}
            <div class="pagination">
                {{ macros.pagination_widget(pagination, '.post', fragment='#comments', id=posts[0].id) }}
            </div>
            {% endif %}
        </div>
        <div class="col-xs-12 col-md-3 article-sidebar-margin-top">{% include '_article_sidebar.html' %}</div>
    </div>
</div>
{% endblock %}

{% block scripts %}
{{- super() -}}
<script type="text/javascript" src="{{ url_for('blog.static', filename='js/smart_navigation.js') }}"></script>
{{- pagedown.include_pagedown() -}}
<script src="{{ url_for('blog.static', filename='editor.md/lib/codemirror/codemirror.min.js') }}"
        type="text/javascript"></script>
<script src="{{ url_for('blog.static', filename='editor.md/lib/flowchart.min.js') }}" type="text/javascript"></script>
<script src="{{ url_for('blog.static', filename='editor.md/lib/jquery.flowchart.min.js') }}"
        type="text/javascript"></script>
<script src="{{ url_for('blog.static', filename='editor.md/lib/prettify.min.js') }}" type="text/javascript"></script>
<script src="{{ url_for('blog.static', filename='editor.md/lib/raphael.min.js') }}" type="text/javascript"></script>
<script src="{{ url_for('blog.static', filename='editor.md/lib/underscore.min.js') }}" type="text/javascript"></script>
<script src="{{ url_for('blog.static', filename='editor.md/lib/sequence-diagram.min.js') }}"
        type="text/javascript"></script>
<script src="{{ url_for('blog.static', filename='editor.md/lib/marked.min.js') }}" type="text/javascript"></script>
<script src="{{ url_for('blog.static', filename='editor.md/editormd.min.js') }}"
        type="text/javascript"></script>
<script type="text/javascript">
        $(document).ready(function() {
            var editor_preview = editormd.markdownToHTML("editormd-post-body", {
                    htmlDecode      : "style,script,iframe",  // you can filter tags decode
                    emoji           : true,
                    taskList        : true,
                    tex             : true,  // 默认不解析
                    flowChart       : true,  // 默认不解析
                    sequenceDiagram : true,  // 默认不解析
                    });
        });

</script>
{% endblock %}